From: Erich E. Hoover Date: Thu, 2 Jul 2026 16:52:33 +0000 (+0000) Subject: DateInfo: Fix timeToStringWithFormat buffer length X-Git-Tag: archive/raspbian/25.03.0-5+rpi1+deb13u4^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=49184b87c21fc0205cfdd2aa6d15b464aa678afd;p=poppler.git DateInfo: Fix timeToStringWithFormat buffer length Origin: upstream, https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1824.patch Applied-Upstream: 25.06.0, https://gitlab.freedesktop.org/poppler/poppler/-/commit/55169105e121d5fbb7c50e2c744d750de5d0a7de Bug: https://gitlab.freedesktop.org/poppler/poppler/-/work_items/1596 Bug-Debian: https://bugs.debian.org/1127146 Reviewed-By: John Scott Last-Update: 2026-07-01 strftime places a NULL-terminated string in the buffer, so the std::string buffer needs to be resized to not include the terminator character (or anything after it). Without this fix, modification dates in altered PDF documents (such as when adding a digital signature) are not truncated properly, instead padding the date with a null byte and extra spaces until the end of the buffer is reached. This bad syntax compromises the ability to verify the signature with other applications, but the Poppler signatory has no indication of this. Gbp-Pq: Name malformed-moddate.patch --- diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc index 3c893e0..8f34236 100644 --- a/poppler/DateInfo.cc +++ b/poppler/DateInfo.cc @@ -122,6 +122,7 @@ std::string timeToStringWithFormat(const time_t *timeA, const char *format) while (strftime(&buf[0], buf.size(), fmt.c_str(), &localtime_tm) == 0) { buf.resize(bufLen *= 2); } + buf.resize(buf.find('\0')); return buf; }